﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Shapes;

namespace Asko.Lib.Views
{
    public class EdgeView : Control
    {
        #region Champs
        public NodeView _source, _destination;
        #endregion

        #region Méthodes
        public EdgeView()
        {
            _source = _destination = null;
        }
        static EdgeView()
        {
            //override the StyleKey
            DefaultStyleKeyProperty.OverrideMetadata(typeof(EdgeView), new FrameworkPropertyMetadata(typeof(EdgeView)));
        }
        #endregion

        #region Propriétés
        /// <summary>
        /// Retourne les points
        /// </summary>
        public static readonly DependencyProperty RoutePointsProperty = DependencyProperty.Register("RoutePoints",
                                                                                            typeof(Point[]),
                                                                                            typeof(EdgeView),
                                                                                            new UIPropertyMetadata(
                                                                                                null));
        public Point[] RoutePoints
        {
            get { return (Point[])GetValue(RoutePointsProperty); }
            set { SetValue(RoutePointsProperty, value); }
        }
        /// <summary>
        /// Retourne le noeud source
        /// </summary>
        public static readonly DependencyProperty SourceProperty = DependencyProperty.Register("Source",
                                                                                               typeof(NodeView),
                                                                                               typeof(EdgeView),
                                                                                               new UIPropertyMetadata(null));
        public NodeView Source
        {
            get { return (NodeView)GetValue(SourceProperty); }
            set { SetValue(SourceProperty, value); }
        }
        /// <summary>
        /// Retourne ou définit l'épaiseur du trait
        /// </summary>
        public static readonly DependencyProperty StrokeThicknessProperty = Shape.StrokeThicknessProperty.AddOwner(typeof(EdgeView),
                                                                                                                   new UIPropertyMetadata(2.0));
        public double StrokeThickness
        {
            get { return (double)GetValue(StrokeThicknessProperty); }
            set { SetValue(StrokeThicknessProperty, value); }
        }
        /// <summary>
        /// Retourne le noeud destination
        /// </summary>
        public static readonly DependencyProperty TargetProperty = DependencyProperty.Register("Target",
                                                                                               typeof(NodeView),
                                                                                               typeof(EdgeView),
                                                                                               new UIPropertyMetadata(null));
        public NodeView Target
        {
            get { return (NodeView)GetValue(TargetProperty); }
            set { SetValue(TargetProperty, value); }
        }
        #endregion
    }
}
